package org.znxs.znxsojservice.services;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.znxs.model.model.entity.Question;
import org.znxs.model.model.entity.QuestionSubmit;

/**
 * 题目服务
 */
@FeignClient(name = "znxs-oj-question", path = "/api/question/inner")
public interface QuestionFeignClient {

    /**
     * 根据提交题目id获取提交题目
     *
     * @param questionSubmitId 提交题目
     * @return
     */
    @GetMapping("/submit/get/id")
    QuestionSubmit getSubmitById(@RequestParam("questionSubmitId") long questionSubmitId);

    /**
     * 根据题目id获取题目
     *
     * @param questionId 题目 id
     * @return
     */
    @GetMapping("/get/id")
    Question getById(@RequestParam("questionId") long questionId);

    /**
     * 更新提交题目
     *
     * @param updateQuestionSubmit 需要更新的提交题目对象 包含id和更新内容
     * @return
     */
    @PostMapping("/update/id")
    boolean updateById(@RequestBody QuestionSubmit updateQuestionSubmit);

}
